package com.rico.redis.controller;

import com.rico.redis.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redis")
public class RedisController {
    @Autowired
    private RedisService redisService;

    /**
     * redis获取缓存
     * @return
     */
    @GetMapping("/getCache")
    public String getCache(String key) {
        return this.redisService.getCache(key);
    }

    /**
     * redis设置缓存
     * @return
     */
    @GetMapping("/setCache")
    public void setCache(String key,String value) {
        this.redisService.setCache(key,value);
    }
}
